import { defineStore } from 'pinia'
import { ref } from 'vue'
import type { AddressItem } from '@/types/address'

export const useAddressStore = defineStore('address', () => {
  // 用户选中的收货地址
  const selectedAddress = ref<AddressItem>()

  const setSelectedAddress = (address: AddressItem) => {
    selectedAddress.value = address
  }

  return {
    selectedAddress,
    setSelectedAddress,
  }
})
